package com.heyqing.topic.FindContentChildren_0455;

import java.util.Arrays;

/**
 * ClassName:FindContentChildren
 * Package:com.heyqing.topic.FindContentChildren_0455
 * Description:
 *
 * @Date:2024/9/30
 * @Author:Heyqing
 */
public class FindContentChildren {
    public int findContentChildren(int[] g, int[] s) {
        Arrays.sort(g);
        Arrays.sort(s);
        int count = 0;
        for (int i = 0; i < s.length; i++) {
            for (int j = 0; j < g.length; j++) {
                if (s[i] >= g[j]) {
                    g[j] = Integer.MAX_VALUE;
                    s[i] = Integer.MIN_VALUE;
                    count++;
                }
            }
        }
        return count;
    }
}
